/**
 * @author SilverBiology, LLC
 * @website http://code.google.com/p/gbif-spreadsheet-processor/
*/
Ext.namespace('GBIF');
Ext.namespace('GBIF.GeoSpatial')

GBIF.GeoSpatial.WMSFeatureGrid = function(config){    

	var sm = new Ext.grid.CheckboxSelectionModel(); 

    var store = new GeoExt.data.AttributeStore({
			url: '../resources/api/proxy.php?url=http://ogc.gbif.org/wfs&request=describefeaturetype&service=wfs&version=1.0.0&outputformat=xmlschema&TypeName=gbif:named_areas'
		});
    
 	Ext.apply(this,config,{
			title: "Feature Attributes"
		,	store: store
		,	border:false
		,	loadMask:true
		,	loaded:false
		,	sm:sm
		,	multiSelect:true
		,	cm: new Ext.grid.ColumnModel([
					sm
				,	{ header: "Name", width:200, dataIndex: "name", sortable: true}
				,	{ header: "Type", dataIndex: "type", sortable: true}
			])
		,	tbar:[{
					text:'Add Features'
				,	ref:'../addfeatures'
				,	scope:this	
				,	handler:this.addFeatures
			}]				
	});    

	GBIF.GeoSpatial.WMSFeatureGrid.superclass.constructor.call(this, config);
}

Ext.extend(GBIF.GeoSpatial.WMSFeatureGrid,Ext.grid.GridPanel, {
		
	addFeatures:function(){	
		GBIF.GeoSpatial.BUS.fireEvent('addFeatures',this);	
	}

});